﻿using System.Collections;
using UnityEngine;
using static RoleController;

public class MonsterStateReturn : FSMState
{
    private MonsterController monster => fsm.role as MonsterController;
    public override void Enter()
    {
        monster.agent.stoppingDistance = 0;
        monster.agent.SetDestination(monster.home);
        monster.agent.isStopped = false;
    }

    public override void Exit()
    {

    }

    public override void Update()
    {
        if (monster.hp <= 0)
        {
            return;
        }
        if ((monster.transform.position - monster.home).magnitude < 1)
        {
            monster.hp = monster.hpMax;
            fsm.SetState("Idle");
        }
    }
}
